/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef FORMAT_H
#define FORMAT_H

class Format
{
public:
	Format( int frequency, int channels, int bit_rate )
	:	frequency( frequency ),
		channels( channels ),
		bit_rate( bit_rate )
	{}

	Format()
	{}

	int get_frequency()const
	{
		return frequency;
	}
	int get_channels()const
	{
		return channels;
	}
	int get_bit_rate()const
	{
		return bit_rate;
	}
	int get_sample_size()const
	{
		return channels * bit_rate / 8;
	}
	char silence_byte()const
	{
		return bit_rate == 16 ? 0 : 0x80;
	}

	bool operator== ( const Format & format )const
	{
		return frequency == format.frequency &&
				channels == format.channels &&
				bit_rate == format.bit_rate;
	}

	static Format any_format()
	{
		static Format any( 0, 0, 0 );
		return any;
	}

protected:
	int frequency;
	int channels;
	int bit_rate;
};

#endif //FORMAT_H